﻿using SAO.OracleHelper;
using SAO.OracleHelper.MappingExtend;
using SAO.OracleHelper.ReflectionExtensions;
using SAO.OracleHelper.ValiDateModel;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;

namespace Tests
{
    class Program
    {
        static void Main(string[] args)
        {
            OracleSqlHelper _OracleDb = new OracleSqlHelper("User Id=u8cloud;Password=12346;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=orcl)))");

            var models = _OracleDb.Query<AccountAgeModel13>();

            List<AccountAgeView13> accountAgeViews = new List<AccountAgeView13>();
            Stopwatch watch = new Stopwatch();
            watch.Start();
            //foreach (var item in models)
            //{
            //    var a = ExpressionGenericMapper<AccountAgeModel13, AccountAgeView13>.Trans(item);
            //    accountAgeViews.Add(a);
            //}
            var a = ExpressionGenericMapper<AccountAgeModel13, AccountAgeView13>.TransAsync(models);
            var b = a.Result;
            watch.Stop();
            Console.WriteLine(watch.ElapsedMilliseconds);
            Console.WriteLine("执行完成");
        }
        [Table("ARAP_BALANCE")]

        public class AccountAgeModel13
        {
            public string ACCPERIOD { get; set; }
            public string BILLCLASS { get; set; }
            public long DR { get; set; }
            public decimal ESTFLAG { get; set; }
            public string PK_BALANCE { get; set; }
        }
        [OracleDataBase]
        public class AccountAgeView13
        {
            public string ACCPERIOD { get; set; }
            public string BILLCLASS { get; set; }
            public long DR { get; set; }
            public decimal ESTFLAG { get; set; }
            public string PK_BALANCE { get; set; }
            public string Year { get; set; }
            public string Month { get; set; }
            public string DeptCode { get; set; }
            public string DeptName { get; set; }
            public string InvCode { get; set; }
            public string InvName { get; set; }
            public string StorName { get; set; }
            public string Cwtjx { get; set; }
            public decimal Nnumber { get; set; }
            public decimal MaterialCost { get; set; }
            public decimal UserCost { get; set; }
            public decimal ManufactureCost { get; set; }
            public decimal Zcb { get; set; }
            public decimal CbPrice { get; set; }
            public decimal RPowerCost { get; set; }
            public decimal PagCost { get; set; }
            public decimal EleCost { get; set; }
        }
    }
}
